import { defineStore } from "pinia";

// 保存登录信息
export const useUserStore = defineStore('user', {
    state: () => {
        return {
            username: '',
            nickname: '',
            id: '',
        }
    },
    actions: {
        setUser(username, nickname, id) {
            this.username = username;
            this.nickname = nickname;
            this.id = id;
        }
    },
    persist:{
        enabled:true,
        strategies:[
            {
                key:'user',
                storage:localStorage
            }
        ]
    }

})
